package org.example;

import java.lang.reflect.Field;
import java.util.Map;

public class App {
    public static void main(String[] args)throws Exception {
//        String property = System.getProperty("java.class.path");
//        System.out.println(property);

        Map<String, String> getenv = System.getenv();
        System.out.println("env1的System.hashCode:"+System.identityHashCode(getenv));
        System.out.println("env1的hashCode:"+getenv.hashCode());
        System.out.println(getenv.keySet().size());


        Map<String, String> getenv2 = System.getenv();
        Field m = getenv2.getClass().getDeclaredField("m");
        m.setAccessible(true);
        Map<String,String> map =(Map<String,String>) m.get(getenv2);
        map.put("KEY1", "value1");
        System.out.println(map.keySet().size());

        System.out.println("env2的System.hashCode:"+System.identityHashCode(getenv2));
        System.out.println("env2的hashCode:"+getenv2.hashCode());

        System.out.println(System.getenv("KEY1"));
        System.out.println(getenv.get("KEY1"));
        System.out.println(getenv2.get("KEY1"));


    }
}
